<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>增加用户</title>
		<link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.4.1/themes/default/easyui.css" />
		<link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.4.1/themes/icon.css" />
		<script type="text/javascript" src="js/jquery-easyui-1.4.1/jquery.min.js"></script>
		<script type="text/javascript" src="js/jquery-easyui-1.4.1/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="js/jquery-easyui-1.4.1/locale/easyui-lang-zh_CN.js"></script>
		<script type="text/javascript">
			var contentPage = {
        			submitForm:function(){
        				if(!$('#myForm').form('validate')){
        					$.messager.alert('提示','信息不完整');
        					return ;
    					}else{
    						$.post("user/addUser",$("#myForm").serialize(),function(data){
    	    					if(data.state == 200){
    	    						$.messager.alert('提示','添加成功');
    	    						$("#myForm").form("reset");
    	    						$("#d").window("close");
    	    						$("#ta").datagrid("reload");
    	    					}else{
    	    						$.messager.alert('提示','添加失败');
    	    					}
    	    				});
    						
    					}
        			},
        			clearForm:function(){
        				$("#myForm").form("reset");
        			}
        	};
		</script>
	</head>
	<body>
		<form id="myForm">
			<div id="p" class="easyui-panel" title="My Panel"     
	        style="width:400px;height:200px;padding:10px;background:#fafafa;"   
	        data-options="iconCls:'icon-save',closable:true,    
	                collapsible:true,minimizable:true,maximizable:true" align="center">   
		    用户名：<input class="easyui-textbox" type="text" name="username" data-options="required:true"><br /><br />
		    密&nbsp;&nbsp;&nbsp;码：<input class="easyui-textbox" type="password" name="userpwd" data-options="required:true"><br /><br />
		    角&nbsp;&nbsp;&nbsp;色：<select id="cc" class="easyui-combobox" name="roleid" style="width:145px;">   
		    						<option value="0">员工</option>
								    <option value="1">收银员</option>   
								    <option value="2">仓库管理员</option>   
					  			</select><br /><br />
		    	<a href="javascript:void(0)" class="easyui-linkbutton" onclick="contentPage.submitForm()" data-options="iconCls:'icon-add'">提交</a>
		    	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		    	<a href="javascript:void(0)" class="easyui-linkbutton" onclick="contentPage.clearForm()" data-options="iconCls:'icon-redo'">重置</a>
				<br /><br />
			</div>
		</form>
	</body>
</html>